package com.my.util;

import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;

public class BindingResultUtil {
	
	private static final String DEFAULTMESSAGE= "参数错误";

	/**
	 * 获取参数错误
	 * @return
	 */
	public static String getErrorParams(BindingResult result) {
		for(FieldError error: result.getFieldErrors() ){
			return error.getDefaultMessage();
		}
		return DEFAULTMESSAGE;
	}
}
